<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/kt/common/inc.jsp" %>
<title>选人</title>
</head>
<script type="text/javascript">
	$(function (){
		var inputId = "${inputId}";
		var uri = "";
		if(inputId == 'superLeader'){
			uri="departmentController/selectDepartUser?inputId=${inputId}&choicedParentDepart=${choicedParentDepart}&managerId=${managerId}";
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
               uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&choicedParentDepart=${choicedParentDepart}&managerId=${managerId}";
            }
		}else if(inputId == 'manager' || inputId.indexOf('multi')>=0){ //如果需要多个变量设置多选时，请以multi开头
			uri = "departmentController/selectDepartUser?inputId=${inputId}&managerId=${managerId}";
            if("${customCode}"== "tianjin712suo"){
                uri = "departTianSevenController/selectManagerUser?type=1&inputId=${inputId}&managerId=${managerId}&departId=${departId}";
            }
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&managerId=${managerId}";
            }
		}else if(inputId == 'project_managers'){
			uri = "departmentController/selectDepartUser?inputId=${inputId}&departId=${departId}&managerId=${managerId}";
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&departId=${departId}&managerId=${managerId}";
            }
		}else if(inputId == 'charge' || inputId == 'project_manager' || inputId.indexOf('single')>=0){ //如果需要多个变量设置单选时，请以single开头
            uri = "departmentController/selectManagerUser?type=1&inputId=${inputId}&managerId=${managerId}&departId=${departId}";
            if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectManagerUser?type=1&inputId=${inputId}&managerId=${managerId}&departId=${departId}";
            }
		}else if(inputId == 'projectSupervision'){
			uri = "departmentController/selectDepartUser?inputId=${inputId}&departId=${departId}&managerId=${managerId}";
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&departId=${departId}&managerId=${managerId}";
            }
		}else if(inputId == 'roleUser'){
			uri = "projectRoleUser/selectRoleUser?roleId=${roleId}&userId=${userId}";
		}else if(inputId == 'managerUser'){
			uri = "departmentController/selectDepartUser?inputId=${inputId}&userId=${userId}&managerId=${managerId}";
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&userId=${userId}&managerId=${managerId}";
            }
		}else if(inputId == 'projectRoleUser'){
			uri = "projectRoleUser/selectProjectRoleUser?roleIds=${roleIds}&userIds=${userIds}&personId=${personId}&dataSource=${dataSource}&target=${target}";
		}else if(inputId.indexOf('projectInner')>=0){
			uri = "documentProjectInnerUserController/selectProjectInner?inputId=${inputId}&projectInnerIds=${projectInnerIds}&projectId=${projectId}";
		}else if(inputId=="chargeInDeptAdd"){
			uri = "departmentController/selectManagerUser?type=1&inputId=${inputId}&managerId=${managerId}&departId=${departId}";
			if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                uri = "departTianSevenController/selectManagerUser?type=1&inputId=${inputId}&managerId=${managerId}&departId=${departId}";
            }
		}else{
			 uri = "departmentController/selectDepartUser?inputId=${inputId}&managerId=${managerId}";
			 if("${customCode}"== "tianjin712suo"){//712 排除废弃部门
                 uri = "departTianSevenController/selectDepartUser?inputId=${inputId}&managerId=${managerId}";
             }
		}
        if(uri.indexOf("?") != -1){
            uri= uri+"&random="+Math.random();
        }else {
            uri= uri+"?random="+Math.random();
        }
		/* var uri = "${uri}";${departId}
		var str_replaced = uri.replace(/\?\?/g,"\&"); */
		$("#selectIframe").attr("src","${_baseUrl}/"+uri);
		
		$("#submit").click(function (){

			var selectIframe = document.getElementById('selectIframe');
			selectIframe.contentWindow.save();
		});
		
		$("#cancel").click(function (){
			var index = parent.layer.getFrameIndex(window.name);  
			parent.layer.close(index); 
		});
		$("#search").click(function (){
			var value = $("#searchValue").val();
			var selectIframe = document.getElementById('selectIframe');
			selectIframe.contentWindow.search(value);
			/* ($("#selectIframe").contents().find("#userList p input")).each(function(){
				alert($(this).is(':checked').val());
				 alert($(this).val())
				 if($('#userList p input').is(':checked')) {
			$('#userList p input').parent().addClass("pick");
		}
			}) */
		});
		$("#searchValue").keydown(function(event) {//给输入框绑定按键事件
		    if(event.keyCode == "13") {//判断如果按下的是回车键则执行下面的代码
		    	var value = $("#searchValue").val();
				var selectIframe = document.getElementById('selectIframe');
				selectIframe.contentWindow.search(value);
		  	}
		});
		$("#searchValue").keyup(function(event){
			 if(event.keyCode =="32"){
				var value = $("#searchValue").val();
				var selectIframe = document.getElementById('selectIframe');
				selectIframe.contentWindow.search(value);
			  }
		});
	});
</script>
<style type="text/css">
    .page_1200{
        overflow: hidden;
    }
</style>
<body>
<div class="func_bar" style="margin: 13px auto 10px;">
	<div class="search_container">
		<div class="func_search">
				<div class="func_search_div"></div>
               <input type="text" name="user_date" value="" id="searchValue" placeholder="请输入人员名称"/>
               <a class="search_btn" id="search" href="javascript:;"></a>
	  	</div>
	</div>
</div>
<div style="margin-top:40px;width: 98%;margin: auto;" id='iframeCont' class='iframeCont'>
    <iframe width='100%' height='100%' id="selectIframe" frameborder="none" scrolling="auto" ></iframe>
</div>
<div class="important_Preservation_c" >
    <div class="important_Preservation">
        <a href="javascript:;" id="submit">提交</a>
        <a href="javascript:;" id="cancel">取消</a>
    </div>
</div>
</body>

<script type="text/javascript">
    var  resizeTimer = null;
    window.onload = function(){
        initHeight();
    }

    function initHeight(){
        var topH = 0;
        if(navigator.userAgent.indexOf("MSIE")>0 || navigator.userAgent.indexOf("like Gecko")>0) {//IE浏览器
            initheight = document.documentElement.clientHeight-topH;
        }
        if(navigator.userAgent.indexOf("Firefox")>0){//Firefox浏览器
            initheight = document.documentElement.clientHeight-topH;
        }
        if(navigator.userAgent.indexOf("Opera")>0){//Opera浏览器
            initheight = document.body.clientHeight-topH;
        }
        if(navigator.userAgent.indexOf("Chrome")>0){//Chrome谷歌浏览器
            initheight = document.documentElement.clientHeight-topH;
        }
        if(navigator.userAgent.indexOf("Safari")>0){//Safari浏览器
            initheight = document.documentElement.clientHeight-topH;
        }
        $("#iframeCont").css( "height",initheight -115 );
    }
</script>
</html>